#!/usr/bin/env python
from math import cos, sin

import pygame

import primitives
import render

#Graphics constants
COLOR0 = 255, 255, 255
COLOR1 = 255, 127, 0
COLOR2 = 255, 0, 0
COLOR3 = 0, 0, 0

class Block:
    def __init__(self):
        self.touched = False
        self.rect = pygame.Rect(self.getRectangle())
        
        self.image = render.silhouette(self, COLOR1, True)
        self.hitImage = render.silhouette(self, COLOR2, True)
    
    def draw(self, display):
        display.blit(self.image, self.rect)

class Rectangle(Block, primitives.Rectangle):
    def __init__(self, x, y, w, h):
        primitives.Rectangle.__init__(self, x-w/2.0, y-h/2.0, w, h)
        Block.__init__(self)

class Circle(Block, primitives.Circle):
    def __init__(self, x, y, radius):
        primitives.Circle.__init__(self, x, y, radius)
        Block.__init__(self)

class Capsule(Block, primitives.Capsule):
    def __init__(self, x0, y0, x1, y1, radius):
        primitives.Capsule.__init__(self, x0, y0, x1, y1, radius)
        Block.__init__(self)
        
        self.x = (x0 + x1) / 2
        self.y = (y0 + y1) / 2

class Arc(Block, primitives.Arc):
    def __init__(self, x, y, inRadius, outRadius, angle0, angle1):
        primitives.Arc.__init__(self, x, y, inRadius, outRadius, angle0, angle1)
        Block.__init__(self)